﻿package com.core
{
    import __AS3__.vec.*;

    public class ProxyChange extends Object
    {
        private var _property:String;
        private var _oldvalue:Object;
        private var _newvalue:Object;
        private static var _instances:Vector.<ProxyChange> = new Vector.<ProxyChange>;
        private static var _sourceInstance:ProxyChange = new ProxyChange(null, null, null);

        public function ProxyChange(param1:String, param2:Object, param3:Object)
        {
            this._property = param1;
            this._oldvalue = param2;
            this._newvalue = param3;
            return;
        }// end function

        public function destory() : void
        {
            clear(this);
            return;
        }// end function

        public function get property() : String
        {
            return this._property;
        }// end function

        public function get oldvalue() : Object
        {
            return this._oldvalue;
        }// end function

        public function get newvalue() : Object
        {
            return this._newvalue;
        }// end function

        public function isChange() : Boolean
        {
            return this._oldvalue !== this._newvalue;
        }// end function

        public function toString() : String
        {
            return "[ProxyChange:property=" + this._property + ",oldvalue=" + this._oldvalue + ",newvalue=" + this._newvalue + "]";
        }// end function

        public static function getInstance(param1:String, param2:Object, param3:Object) : ProxyChange
        {
            var _loc_4:ProxyChange = null;
            if (_instances.length > 0)
            {
                _loc_4 = _instances.pop();
                _loc_4._newvalue = param3;
                _loc_4._property = param1;
                _loc_4._oldvalue = param2;
                return _loc_4;
            }
            return new ProxyChange(param1, param2, param3);
        }// end function

        private static function clear(param1:ProxyChange) : void
        {
            param1._property = null;
            param1._oldvalue = null;
            param1._newvalue = null;
            if (_instances.length == 0)
            {
                _instances.push(param1);
            }
            return;
        }// end function

    }
}
